﻿using Comsenz.Services.Blocks.Configs;
using System.Collections.Generic;

namespace Comsenz.Services.Blocks.Models
{
    /// <summary>
    /// 数据定义包
    /// </summary>
    /// <author>Chiron</author>
    public class DefineData
    {
        #region Ctors
        /// <summary>
        /// 构建定义包
        /// </summary>
        public DefineData()
        {
            Title = "Discuz! Block";
        }
        /// <summary>
        /// 构建定义包
        /// </summary>
        /// <param name="data">数据定义</param>
        public DefineData(IConfig data)
            : this()
        {
            Data = data;
        }
        #endregion Ctors

        #region Props
        /// <summary>
        /// 包类型名
        /// </summary>
        public string Title { get; protected set; }

        /// <summary>
        /// 数据定义
        /// </summary>
        public IConfig Data { get; set; }
        #endregion Props

        #region Methods
        /// <summary>
        /// 取得配置值
        /// </summary>
        /// <returns></returns>
        public Dictionary<object, object> GetConfigValue()
        {
            return new Dictionary<object, object>
            {
                {"Title",Title},
                {"Data",Data!=null?Data.GetConfigValue():null}
            };
        }
        #endregion Methods

    }
}
